/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores.ControladorAutores;

import DAOS.DAOSAUTORES.TesisDAO;
import Entidades.EntidadesAutores.Tesis;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author frankdedios
 */
@ManagedBean
@RequestScoped
public class ControladorAutores_Tesis {
@EJB TesisDAO tesis;
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
     int idtesis;
    Tesis tesisactual;
    List<Tesis> listatesis;
    String idtesisNueva;
    String cadena;

    public String getCadena() {
        return cadena;
    }

    public void setCadena(String cadena) {
        this.cadena = cadena;
    }

    public int getIdtesis() {
        return idtesis;
    }

    public void setIdtesis(int idtesis) {
        this.idtesis = idtesis;
    }

    public String getIdtesisNueva() {
        return idtesisNueva;
    }

    public void setIdtesisNueva(String idtesisNueva) {
        this.idtesisNueva = idtesisNueva;
    }

    public List<Tesis> getListatesis() {
        return listatesis;
    }

    public void setListatesis(List<Tesis> listatesis) {
        this.listatesis = listatesis;
    }

    public TesisDAO getTesis() {
        return tesis;
    }

    public void setTesis(TesisDAO tesis) {
        this.tesis = tesis;
    }

    public Tesis getTesisactual() {
        return tesisactual;
    }

    public void setTesisactual(Tesis tesisactual) {
        this.tesisactual = tesisactual;
    }
    @PostConstruct
    public void inicializar(){
    listatesis= tesis.BuscarTodosTesis();
    tesisactual=listatesis.get(0);     
    }
    public ControladorAutores_Tesis() {
    }
    
    public String IrRegistrarTesis(){
      tesisactual=new Tesis() ;
      return "Registrar Tesis";
    }
    public String IrBuscarTesis(){
     listatesis= tesis.BuscarTesis(cadena);
     tesisactual=listatesis.get(0);       
     return "TESIS";
    }
    public String IrGuardarTesis(){
     tesis.guardar(tesisactual);
     return "TESIS";
    }
    
    public String IrBorrarTesis(Integer id){
        tesis.borrar(id);
        listatesis=tesis.BuscarTodosTesis();
        return "tesis";
    }
}
